home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <fcntl.h>
- #include <time.h>
- #ifdef MAC
- #include <Events.h>
- #include <Files.h>
- #include <Memory.h>
- #endif
- #ifdef MPW
- #include <Strings.h>
- #endif
- #include "hds.h"
-
- /* benchmark for HDS; developed from DS1-benchmark */
-
- #define NUM 1000
- #define TFILE "test.hds"
- #define TPSEC (CLOCKS_PER_SEC*1.)
-
- void main ()
- {
- char *recsat = "RECORDDUMMY";
- char *datsat = "DATENBLOCKDUMMY";
- PAR field;
- int i;
- short ftypn[10], ftypd[10];
- char buff[80];
- unsigned long tcount;
- long gd;
- FILESPEC fs;
- static char *descr[] = {"Variable string for everything"};
-
- unlink (TFILE);
- fs.s = TFILE;
- #ifdef MAC
- fs.vRefNum = 0; /* this volume */
- fs.parID = 0L; /* home directory */
- fs.creator = 'HDSM';
- #endif
- printf ("Start of HDS benchmark\n");
- hdscreat (&fs);
- /* hdssec (); */
- ftypn[0] = STRING_F;
- ftypd[0] = STRING_F;
- gd = hdscregd ("Normal", 1, ftypn, 1, ftypd, descr, descr);
- hdscrerpgd (gd);
- field.s = recsat;
- hdsinsr (&field);
-
- printf ("%d x hdsinse ", NUM);
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsinse (&field);
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
-
- printf ("%d x hdsdown ", NUM);
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsdown ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
-
- printf ("%d x hdsinsd hdsdata hdsdown ", NUM);
- field.s = datsat;
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsinsd (&field);
- hdsdata ();
- hdsdown ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
-
- printf ("%d x hdsdata hdsdata hdsdown ", NUM);
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsdata ();
- hdsdata ();
- hdsdown ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
-
- printf ("%d x hdsdata hdsdata ", NUM);
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsdata ();
- hdsdata ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
-
- printf ("%d x hdsdown hdsup ", NUM);
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsdown ();
- hdsup ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
-
- printf ("%d x hdsdown hdsnfld ", NUM);
- field.s = buff;
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsdown ();
- hdsnfld (&field);
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
-
- printf ("%d x hdscrer hdsinsr ", NUM);
- field.s = recsat;
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdscrerpgd (gd);
- hdsinsr (&field);
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdstop ();
-
- printf ("%d x hdsrght ", NUM);
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsrght ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdstop ();
-
- printf ("%d x hdsrght hdsleft ", NUM);
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsrght ();
- hdsleft ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdstop ();
-
- printf ("%d x hdsrght hdsnfld ", NUM);
- field.s = buff;
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsrght ();
- hdsnfld (&field);
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdstop ();
- hdsrght ();
-
- printf ("%d x hdsdown hdsdel ", (NUM >> 1));
- field.s = buff;
- tcount = clock ();
- for (i = 0; i < (NUM >> 1); i++) {
- hdsdown ();
- hdsdel ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
- hdsrght ();
-
- printf ("%d x hdsinse ", NUM);
- field.s = recsat;
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsinse (&field);
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
- hdsrght ();
-
- printf ("%d x hdsinse ", NUM);
- field.s = recsat;
- tcount = clock ();
- for (i = 0; i < NUM; i++) {
- hdsinse (&field);
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsfrst ();
- hdsdown ();
-
- printf ("%d x hdsdel ", (NUM >> 1));
- field.s = buff;
- tcount = clock ();
- for (i = 0; i < (NUM >> 1); i++) {
- hdsdel ();
- }
- printf ("%f\n", (clock() - tcount) / TPSEC);
-
- hdsclose ();
- fflush (stdout);
- exit (0);
- }
-